//时间转换
function transfor_date(date) {
	let d1 = new Date(date); //时间 格式转换
	let d2 = new Date()
	let start_date = d1.getFullYear() + '-' + (d1.getMonth() + 1) + '-' + d1.getDate() + ' ' + d2.getHours() + ':' + d2.getMinutes() +
		':' + d2.getSeconds()
	return start_date
}

//获取时间
function getBeforeDate(n) { //n为你要传入的参数，当前为0，前一天为-1，后一天为1
	let date = new Date();
	let year, month, day, s;
	date.setDate(date.getDate() + n);
	year = date.getFullYear();
	month = date.getMonth() + 1;
	day = date.getDate();
	s = year + '-' + (month < 10 ? ('0' + month) : month) + '-' + (day < 10 ? ('0' + day) : day);
	return s;
}

module.exports={
	transfor_date,
	getBeforeDate
}